package cn.ctodb.cms.service.mapper;

import cn.ctodb.cms.domain.*;
import cn.ctodb.cms.service.dto.CmsImgDTO;

import org.mapstruct.*;
import java.util.List;

/**
 * Mapper for the entity CmsImg and its DTO CmsImgDTO.
 */
@Mapper(componentModel = "spring", uses = {})
public interface CmsImgMapper {

    @Mapping(source = "cmsContent.id", target = "cmsContentId")
    CmsImgDTO cmsImgToCmsImgDTO(CmsImg cmsImg);

    List<CmsImgDTO> cmsImgsToCmsImgDTOs(List<CmsImg> cmsImgs);

    @Mapping(source = "cmsContentId", target = "cmsContent")
    CmsImg cmsImgDTOToCmsImg(CmsImgDTO cmsImgDTO);

    List<CmsImg> cmsImgDTOsToCmsImgs(List<CmsImgDTO> cmsImgDTOs);

    default CmsContent cmsContentFromId(Long id) {
        if (id == null) {
            return null;
        }
        CmsContent cmsContent = new CmsContent();
        cmsContent.setId(id);
        return cmsContent;
    }
}
